package com.tongtailian.www.stir.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tongtailian.www.stir.R;
import com.tongtailian.www.stir.bean.NumberBean;

import java.util.List;

/**
 * Created by liuml on 2020/9/6 16:48
 */
public class SelectCustomGroupAdapter extends BaseQuickAdapter<NumberBean, BaseViewHolder> {
    public SelectCustomGroupAdapter(int layoutResId, @Nullable List<NumberBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, NumberBean item) {
        if (item.isSelect()) {
            helper.setBackgroundRes(R.id.bt_group_name, R.mipmap.bt_custom_group_sel_bg);
            helper.setTextColor(R.id.bt_group_name, Color.parseColor("#ffffff"));
        }else {
            helper.setTextColor(R.id.bt_group_name, Color.parseColor("#000000"));
            helper.setBackgroundRes(R.id.bt_group_name, R.mipmap.bt_custom_group_unsel_bg);
        }
        helper.setText(R.id.bt_group_name, item.getName());
        helper.setText(R.id.bt_config_name, item.getGroup_name()+item.getConfig());
        helper.addOnClickListener(R.id.bt_group_name);
        helper.addOnClickListener(R.id.bt_config_name);
    }
}